import Immutable from 'immutable'
import {
  SELECT_TABBAR
} from '../constants/actionType'

const initialState = Immutable.fromJS({
  list: [],
  refreshing: true,
  loadingMore: false,
  totalPage: 0,
  topViewPages: [
    'https://images.unsplash.com/photo-1441742917377-57f78ee0e582?h=1024',
    'https://images.unsplash.com/photo-1441716844725-09cedc13a4e7?h=1024',
    'https://images.unsplash.com/photo-1441448770220-76743f9e6af6?h=1024',
    'https://images.unsplash.com/photo-1441260038675-7329ab4cc264?h=1024',
    'https://images.unsplash.com/photo-1441126270775-739547c8680c?h=1024',
    'https://images.unsplash.com/photo-1440964829947-ca3277bd37f8?h=1024',
    'https://images.unsplash.com/photo-1440847899694-90043f91c7f9?h=1024'
  ]
})

// const initialState = {
//   list: [],
//   refreshing: true,
//   loadingMore: false,
//   totalPage: 0,
//   topViewPages: [
//     'https://images.unsplash.com/photo-1441742917377-57f78ee0e582?h=1024',
//     'https://images.unsplash.com/photo-1441716844725-09cedc13a4e7?h=1024',
//     'https://images.unsplash.com/photo-1441448770220-76743f9e6af6?h=1024',
//     'https://images.unsplash.com/photo-1441260038675-7329ab4cc264?h=1024',
//     'https://images.unsplash.com/photo-1441126270775-739547c8680c?h=1024',
//     'https://images.unsplash.com/photo-1440964829947-ca3277bd37f8?h=1024',
//     'https://images.unsplash.com/photo-1440847899694-90043f91c7f9?h=1024'
//   ]
// }

export default (state = initialState, action) => {
  let newState = state
  switch (action.type) {
    case SELECT_TABBAR:
      newState = newState.set('refreshing', action.payload.argument)
      return newState
    default :
      return state
  }
}
